/* GUI CONVERTED from reiq03.p (converter v1.76) Wed May 22 11:22:37 2002 */
/* reiq03.p - Repetitive Subcontract Shipper/Container Inquiry                */
/* Copyright 1986-2002 QAD Inc., Carpinteria, CA, USA.                        */
/* All rights reserved worldwide.  This is an unpublished work.               */
/* $Revision: 1.6.1.4 $                                                       */
/*V8:ConvertMode=Report                                                       */
/* REVISION: 7.3      LAST MODIFIED: 10/31/94   BY: WUG *GN77*                */
/* REVISION: 8.6      LAST MODIFIED: 04/09/97   BY: *K08N* Steve Goeke        */
/* REVISION: 8.6      LAST MODIFIED: 10/23/97   BY: mur *K13K*                */
/* REVISION: 8.6E     LAST MODIFIED: 02/23/98   BY: *L007* A. Rahane          */
/* REVISION: 8.6E     LAST MODIFIED: 10/04/98   BY: *J314* Alfred Tan         */
/* REVISION: 9.1      LAST MODIFIED: 03/24/00   BY: *N08T* Annasaheb Rahane   */
/* REVISION: 9.1      LAST MODIFIED: 08/12/00   BY: *N0KP* Mark Brown         */
/* Old ECO marker removed, but no ECO header exists *F0PN*                    */
/* $Revision: 1.6.1.4 $   BY: Jean Miller        DATE: 05/22/02  ECO: *P05V*  */
/******************************************************************************/
/* All patch markers and commented out code have been removed from the source */
/* code below. For all future modifications to this file, any code which is   */
/* no longer required should be deleted and no in-line patch markers should   */
/* be added.  The ECO marker should only be included in the Revision History. */
/******************************************************************************/

/* SUBCONTRACT SHIPPER/CONTAINER INQUIRY */

/*GUI preprocessor directive settings */
&SCOPED-DEFINE PP_GUI_CONVERT_MODE REPORT

{mfdtitle.i "2+ "}

define variable type like mfc_logical label "Type" format "Shipper/Container"
   initial yes.
define variable ctype as character label "T" format "x(1)".
define variable disp_abs_id as character.

define variable indent_id as character format "x(12)" label "ID".
define shared variable global_recid as recid.


/*GUI preprocessor Frame A define */
&SCOPED-DEFINE PP_FRAME_NAME A

FORM /*GUI*/ 
   
 RECT-FRAME       AT ROW 1 COLUMN 1.25
 RECT-FRAME-LABEL AT ROW 1 COLUMN 3 NO-LABEL VIEW-AS TEXT SIZE-PIXELS 1 BY 1
 SKIP(.1)  /*GUI*/
type                 colon 28
   abs_shipfrom         colon 28 label "Ship-From Site"
   si_desc              at 45 no-label
   abs_id               colon 28 label "Shipper/Container ID"
with frame a side-labels width 80 attr-space NO-BOX THREE-D /*GUI*/.

 DEFINE VARIABLE F-a-title AS CHARACTER INITIAL "".
 RECT-FRAME-LABEL:SCREEN-VALUE in frame a = F-a-title.
 RECT-FRAME-LABEL:HIDDEN in frame a = yes.
 RECT-FRAME:HEIGHT-PIXELS in frame a =
  FRAME a:HEIGHT-PIXELS - RECT-FRAME:Y in frame a - 2.
 RECT-FRAME:WIDTH-CHARS IN FRAME a = FRAME a:WIDTH-CHARS - .5.  /*GUI*/

/*GUI preprocessor Frame A undefine */
&UNDEFINE PP_FRAME_NAME



/* SET EXTERNAL LABELS */
setFrameLabels(frame a:handle).

FORM /*GUI*/ 
   abs_shipto           colon 20 label "Ship-To/Dock"
   ad_name              at 45 no-label
   ad_line1             at 45 no-label
with STREAM-IO /*GUI*/  frame b side-labels width 80 attr-space.

/* SET EXTERNAL LABELS */
setFrameLabels(frame b:handle).

find abs_mstr where recid(abs_mstr) = global_recid no-lock no-error.

if available abs_mstr and
   (abs_id begins "s" or abs_id begins "c") and
   (can-find(im_mstr where
             im_inv_mov = abs_inv_mov and
             im_tr_type = "ISS-WO") or
   abs_type = "u")
then do:

   type = abs_id begins "s".

   find si_mstr where si_site = abs_shipfrom no-lock.

   display
      abs_shipfrom
      si_desc
      abs_id format "x(1)" @ type
      substring(abs_id,2,50) @ abs_id
   with frame a.

end.

display type with frame a.

{wbrp01.i}
repeat:

   do with frame a:

      if c-application-mode <> 'web' then
         prompt-for type abs_shipfrom abs_id
      editing:

         assign
            global_site = input abs_shipfrom
            global_loc = string(input type).

         if frame-field = "abs_shipfrom" then do:

            {mfnp05.i abs_mstr abs_id
               "(abs_id begins substring(input type,1,1)) and
                 (can-find
                 (im_mstr where
                 im_inv_mov = abs_inv_mov and
                 im_tr_type = ""ISS-WO"") or
                 abs_type = ""u"")"
               abs_shipfrom
               "input abs_shipfrom"}

            if recno <> ? then do:

               find si_mstr where si_site = abs_shipfrom no-lock no-error.

               assign
                  disp_abs_id = substring(abs_id,2,50).

               display
                  abs_shipfrom
                  si_desc          when (available si_mstr)
                  ""               when (not available si_mstr) @ si_desc
                  disp_abs_id @ abs_id.
            end.
         end.

         else
         if frame-field = "abs_id" then do:

            {mfnp05.i abs_mstr abs_id
               "(abs_shipfrom = input abs_shipfrom) and
                 (abs_id begins substring(input type,1,1)) and
                 (can-find
                 (im_mstr where
                 im_inv_mov = abs_inv_mov and
                 im_tr_type = ""ISS-WO"") or
                 abs_type = ""u"")"
               abs_id
               "substr(input type,1,1) + input abs_id"}

            if recno <> ? then do:
               find si_mstr where si_site = abs_shipfrom no-lock no-error.

               assign
                  disp_abs_id = substring(abs_id,2,50).

               display
                  abs_shipfrom
                  si_desc          when (available si_mstr)
                  ""               when (not available si_mstr) @ si_desc
                  disp_abs_id @ abs_id.

            end.

         end.

         else do:
            ststatus = stline[3].
            status input ststatus.
            readkey.
            apply lastkey.
         end.

      end.

      {wbrp06.i &command = prompt-for &fields = "  type abs_shipfrom abs_id"
         &frm = "a" }

      assign type.
      assign ctype = if type then "s" else "c".

      find abs_mstr where abs_shipfrom = input abs_shipfrom
                      and abs_id = ctype + input abs_id
      no-lock no-error.

      if not available abs_mstr then do:
         /* Picklist/Shipper does not exist */
         {pxmsg.i &MSGNUM=8108 &ERRORLEVEL=3}
         bell.
         if (c-application-mode = 'web') then return.
         undo, retry.
      end.

      if not can-find
         (im_mstr where
          im_inv_mov = abs_inv_mov and
          im_tr_type = "ISS-WO") and
         (abs_type <> "u")
      then do:
         /* Not a subcontract shipper */
         {pxmsg.i &MSGNUM=5106 &ERRORLEVEL=3}
         if (c-application-mode = 'web') then return.
         undo, retry.
      end.

      find si_mstr where si_site = abs_shipfrom no-lock.

   end.

   /* OUTPUT DESTINATION SELECTION */
   {gpselout.i &printType = "terminal"
               &printWidth = 80
               &pagedFlag = " "
               &stream = " "
               &appendToFile = " "
               &streamedOutputToTerminal = " "
               &withBatchOption = "no"
               &displayStatementType = 1
               &withCancelMessage = "yes"
               &pageBottomMargin = 6
               &withEmail = "yes"
               &withWinprint = "yes"
               &defineVariables = "yes"}
/*GUI*/ RECT-FRAME:HEIGHT-PIXELS in frame a = FRAME a:HEIGHT-PIXELS - RECT-FRAME:Y in frame a - 2.


   assign
      disp_abs_id = substring(abs_id,2,50).

   display
      abs_shipfrom
      si_desc
      disp_abs_id @ abs_id
   with frame a.

   find ad_mstr where ad_addr = abs_shipto no-lock no-error.

   display
      abs_shipto
      ad_name      when (available ad_mstr)
      ad_line1     when (available ad_mstr)
   with frame b STREAM-IO /*GUI*/ .

   put skip(1).

   {gprun.i ""reiq03b.p"" "(input recid(abs_mstr), input 0)"}

   {mfreset.i}
/*GUI*/ {mfgrptrm.i} /*Report-to-Window*/

   {pxmsg.i &MSGNUM=8 &ERRORLEVEL=1}

   if abs_par_id > "" then do:
      /* This is subordinate to # */
      {pxmsg.i &MSGNUM=8102 &ERRORLEVEL=1 &MSGARG1=abs_par_id}
   end.

   assign
      global_recid = recid(abs_mstr).
end.
{wbrp04.i &frame-spec = a}
